Skip to content

add bitor (|) unified operator #7382

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MiryangJung
Copy link
Contributor

@MiryangJung MiryangJung commented Apr 6, 2025

I used the existing Token.Bar, it looks like there's a conflict with the | used in pattern matching, so I'm looking into it.

@cometkim cometkim mentioned this pull request Apr 11, 2025
@cometkim
Copy link
Member

cometkim commented Apr 13, 2025

Ok, this is actually ambiguous.

switch n {
| n => n | 1
      // ^ Is this an or-pattern or binary expression?

This is tricky because we don't force a delimiter at the end of the pattern (like , in Rust)

We can put it in a new region to avoid ambiguity

switch n {
| n => { n | 1 }
// or....
| n => ( n | 1 )

The problem is that our formatter actively tries to wipe it out.

@cometkim
Copy link
Member

Maybe reviving local open syntax would help to deal with this kind of ambiguity

@cometkim cometkim mentioned this pull request Apr 14, 2025
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants